package com.example.sm.mycook.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class SQLiteHelper extends SQLiteOpenHelper {
    public static final String DB_NAME="mycook.db";
    public static final int DB_VERSION=2;
    public SQLiteHelper(Context context) {
        super(context, DB_NAME, null, DB_VERSION);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        //用户信息
    
        db.execSQL("CREATE TABLE IF NOT EXISTS users(_id INTEGER PRIMARY KEY AUTOINCREMENT,tid,name,phone,types,address,path,ischeck)");
        //浏览记录
//        db.execSQL("CREATE TABLE IF NOT EXISTS jilu(_id INTEGER PRIMARY KEY AUTOINCREMENT tid,title,image,pubdate,directors,casts,message)");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        if (newVersion > oldVersion) {
            db.execSQL("DROP TABLE IF EXISTS users");
//            db.execSQL("DROP TABLE IF EXISTS jilu");
            //创建新表
            onCreate(db); //创建新表
        }
    }
}
